//

// (  )
//

package com.tools.acceleratecore.xlib;

import android.content.Context;

import com.dianxinos.acceleratecore.xlib.xlib.intf.IXObject;
import com.tools.acceleratecore.xlib.xlib.impl.XFactory;
import com.tools.acceleratecore.xlib.xlib.impl.XThreadLooper;
import com.tools.acceleratecore.xlib.xlib.impl.XThreadTask;
import com.tools.acceleratecore.xlib.xlib.impl.XThreadTaskQueue;
import com.tools.acceleratecore.xlib.xlib.impl.XTimer;
import com.tools.acceleratecore.xlib.xlib.intf.IXFactory;
import com.tools.acceleratecore.xlib.xlib.intf.IXThreadLooper;
import com.tools.acceleratecore.xlib.xlib.intf.IXThreadTask;
import com.tools.acceleratecore.xlib.xlib.intf.IXThreadTaskQueue;
import com.tools.acceleratecore.xlib.xlib.intf.IXTimer;

import java.util.HashMap;

public class XLibFactory extends XFactory {
    private static IXFactory sIXFactory = null;
    private static Context sContext = null;

    public XLibFactory() {
        this.xFactoryInterfaceMap = new HashMap();

        this.xFactoryInterfaceMap.put(IXThreadTask.class, new XFactoryImplementMap(new Class[]{XThreadTask.class}, new IXObject[1]));
        this.xFactoryInterfaceMap.put(IXThreadLooper.class, new XFactoryImplementMap(new Class[]{XThreadLooper.class}, new IXObject[1]));
        this.xFactoryInterfaceMap.put(IXThreadTaskQueue.class, new XFactoryImplementMap(new Class[]{XThreadTaskQueue.class}, new IXObject[1]));
        this.xFactoryInterfaceMap.put(IXTimer.class, new XFactoryImplementMap(new Class[]{XTimer.class}, new IXObject[1]));
    }

    public static IXFactory getInstance() {
        if (sIXFactory == null) {
            Class var0 = XLibFactory.class;
            synchronized (XLibFactory.class) {
                if (sIXFactory == null) {
                    sIXFactory = new XLibFactory();
                }
            }
        }

        return sIXFactory;
    }

    public static void setApplication(Context context) {
        sContext = context;
    }

    public static Context getApplication() {
        return sContext;
    }
}
